<template>
    <div>
        <div class="block">
            <div style="position: absolute;top: .6rem;left: .6rem;" @click="goBack">< 返回</div>
            <div style="text-align: center;padding: .6rem 0;height: 1rem;"></div>
            <template>
                <div class="item">
                    <div style="font-weight: 900;">{{detail.title}}</div>
                    <div style="font-size: .8rem;">{{detail.create_time}}</div>
                    <div style="margin-top: 1rem;" v-html="detail.content"></div>
                    <!--<span class="el-icon-lx-delete" @click="delAddress"></span>-->
                </div>
            </template>
        </div>
    </div>
</template>

<script>
    export default {
        name: "notice-detail",
        data(){
            return{
                uid: '',
                housinggestateId: '',
                detail: {},
            }
        },
        methods: {
            loadopen() {
                this.loading = this.$loading({lock: true,text: 'Loading',spinner: 'el-icon-loading',background: 'rgba(0, 0, 0, 0.2)'});setTimeout(() => {this.loading.close();}, 5000);
            },
            loadclose() {this.loading.close();},
            // 分页导航
            handleCurrentChange(val) {
            },
            goBack(){
                this.$router.push('/mobile/notice')
            },
            // 获取登录用户信息
            getDetail() {
                this.loadopen();
                this.config.mpost('/api/convenience/convenience/findById', {id: this.uid, housinggestateId: this.housinggestateId}).then(res=>{
                    this.loadclose();
                    if(res.data.code==='0'){
                        this.detail = res.data.checkConvenience;
                    }else {
                        this.$message.error(this.config.mobileError(res.data));
                    }
                })
            },
            search() {
            },
            // 分页导航
            handleCurrentChange(val) {
                console.log(`当前页: ${val}`);
                this.getData(val);
            },
            handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
            },
        },
        mounted(){
            let obj = this.$route.query;
            this.uid = obj.id;
            this.housinggestateId = obj.housinggestateId;
            this.getDetail()
        }
    }
</script>

<style scoped lang="less">
    .block{
        .item{
            color: #333;
            padding: .5rem 1rem;
            margin: .8rem;
            box-shadow: 0 0 10px 0 #ccc;
            border-radius: 6px;
            position: relative;
            .tit{
                color: #666;
            }
            .el-icon-lx-delete{
                position: absolute;top: 10px;right: 10px;color: #8c939d;
            }
        }
    }

    .text{
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
    }
</style>
